﻿using ProtoBuf.Message;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Yunchang;
using Yunchang.NetworkLayer;

namespace AutoChess
{
    partial class AutoChessManager
    {
        public AutoChessCacheData cacheData = new AutoChessCacheData();
        public static void DebugLog(string msg, string type = "")
        {
            //ExLog.LogV(string.Format("<color=red>{1}</color> <color=gray>{0}</color>", msg, type));
        }

        public void RegisterNet()
        {
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessBegin, OnSCAutoChessBegin);            //开始战斗流程
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessReconnect, OnSCAutoChessReconnect);    //战斗重连
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessPlayerEnter, OnSCAutoChessPlayerEnter);    //重新进入响应
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessStateChange, OnSCAutoChessStateChange);       //游戏状态信息变更
            // 主界面相关
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessInfo, OnSCAutoChessInfo); //开始页面信息
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessMatch, OnSCAutoChessMatch); //开始匹配
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessMatchSucess, OnSCAutoChessMatchSucess); //通知客户端自走棋匹配成功，进入倒计时
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCCancelAutoChessMatch, OnSCCancelAutoChessMatch); //取消匹配
        }

        public void UnRegisterNet()
        {
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessBegin, OnSCAutoChessBegin);
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessReconnect, OnSCAutoChessReconnect);    //战斗重连
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessPlayerEnter, OnSCAutoChessPlayerEnter); //重新进入响应
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessStateChange, OnSCAutoChessStateChange);
            // 主界面相关
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessInfo, OnSCAutoChessInfo); //开始页面信息
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessMatch, OnSCAutoChessMatch); //开始匹配
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessMatchSucess, OnSCAutoChessMatchSucess); //通知客户端自走棋匹配成功，进入倒计时
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCCancelAutoChessMatch, OnSCCancelAutoChessMatch); //取消匹配
        }

        #region 战场内的消息
        private void RegisterNetInField()
        {
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessLoadingProgress, OnSCAutoChessLoadingProgress);//加载进度

            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessGoldIncome, OnSCAutoChessGoldIncome);             //收入展示
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessBugChess, OnSCAutoChessBugChess);             //从商店购买一个棋子 
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessMoveChess, OnSCAutoChessMoveChess);           //移动一个棋子 
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessMatchRes, OnSCAutoChessMatchRes);             // 匹配一个玩家
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessFightRes, OnSCAutoChessFightRes);             // 返回战斗结果
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessRoundFightResult, OnSCAutoChessRoundFightResult); // 返回战斗结算结果
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessRefreshChesses, OnSCAutoChessRefreshChesses); //刷新棋子操作 服务器推送的
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessUpgradeShip, OnSCAutoChessUpgradeShip);      //升级船的响应
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessRefreshShip, OnSCAutoChessRefreshShip);      //刷新船的数据
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessGrowthChessStar, OnSCAutoChessGrowthChessStar); //升星的响应
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessSellChess, OnSCAutoChessSellChess);   // 出售响应
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessRefreshBuyChesses, OnSCAutoChessRefreshBuyChesses);   // 花钱购买刷新购买的响应
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessSettlement, OnSCAutoChessSettlement);   //结算一个玩家
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessPlayerQuit, OnSCAutoChessPlayerQuit);   //玩家退出
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessLockShop, OnSCAutoChessLockShop);     //锁定商店
            NetworkDriver.Instance.RegistSocketHandler(OpDefine.SCAutoChessScoreChange, OnSCAutoChessScoreChange);     //段位结算服务器推送阶段的地方
            EventManager.AddEventListener(CommonEvent.ON_Refresh_Cache_HP, ON_Refresh_Cache_HP);
        }
        private void UnRegisterNetInField()
        {
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessLoadingProgress, OnSCAutoChessLoadingProgress);

            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessGoldIncome, OnSCAutoChessGoldIncome);             //收入展示
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessBugChess, OnSCAutoChessBugChess);
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessMoveChess, OnSCAutoChessMoveChess);     //移动一个棋子
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessMatchRes, OnSCAutoChessMatchRes); // 匹配一个玩家
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessFightRes, OnSCAutoChessFightRes); // 返回战斗结果
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessRoundFightResult, OnSCAutoChessRoundFightResult); // 返回战斗结算结果
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessRefreshChesses, OnSCAutoChessRefreshChesses); //通用刷新棋子操作
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessUpgradeShip, OnSCAutoChessUpgradeShip); //升级船的响应
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessRefreshShip, OnSCAutoChessRefreshShip);      //刷新船的数据
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessGrowthChessStar, OnSCAutoChessGrowthChessStar); //升星的响应
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessSellChess, OnSCAutoChessSellChess);   // 出售响应
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessRefreshBuyChesses, OnSCAutoChessRefreshBuyChesses);   // 刷新购买的响应
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessSettlement, OnSCAutoChessSettlement);   //结算一个玩家
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessPlayerQuit, OnSCAutoChessPlayerQuit);   //玩家退出
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessLockShop, OnSCAutoChessLockShop);     //锁定商店
            NetworkDriver.Instance.UnregisterSocketHandler(OpDefine.SCAutoChessScoreChange, OnSCAutoChessScoreChange);     //段位结算服务器推送阶段的地方
            EventManager.RemoveEventListener(CommonEvent.ON_Refresh_Cache_HP, ON_Refresh_Cache_HP);
        }
        #endregion

        #region 回调
        private void ON_Refresh_Cache_HP()
        {
            var players = cacheData.GetAllPlayerList();
            foreach (var item in players)
            {
                item.ResetPlayerHPValue();//将显示和实际同步
                EventManager.TriggerEvent<long>(CommonEvent.ON_Refresh_Ship_HP_UI, item.GUID);
            }
        }
        private void OnSCAutoChessScoreChange(object msg)
        {
            var data = msg as SCAutoChessScoreChange;
            cacheData.overScoreData = data;  
        }
        private void OnSCAutoChessRoundFightResult(object msg)
        {
            var data = msg as SCAutoChessRoundFightResult;
            cacheData.fighResult = data;
        }
        private void OnSCAutoChessGoldIncome(object msg)
        {
            var data = msg as SCAutoChessGoldIncome;

            AutoChessFieldViewCtr.Ins.ActionCtr.AddQueueAction(ActionQueueType.AdjustStart,
                () => {
                    EventManager.TriggerEvent<SCAutoChessGoldIncome>(CommonEvent.ON_AUTOCHESSS_INCOME, data);
                }, 0, 1);
        }

        //战斗开始消息 (不管是重连还是战斗开始 进去首先都是自己的视角)
        private void OnSCAutoChessBegin(object msg)
        {
            var data = msg as SCAutoChessBegin;

            cacheData.UpdateDataAtBegin(data.info);
           
            EnterAutoChessField();

            ServerTimerTool.Reset();
            ServerTimerTool.CorrectTime(data.info.time);
            DebugLog("自走棋 【推送战斗开始...】");
        }
        //战斗重连
        private void OnSCAutoChessReconnect(object msg)
        {
            DebugLog("战斗重连!!!!!!!!!!!!!!!!!!!!!", "状态相关");
            reconnected = false;
            var data = msg as SCAutoChessReconnect;
            cacheData.reconnectData = data;
            cacheData.UpdateDataAtBegin(data.info);

            //ReconnectFuc();
        }

        /// <summary>
        /// 和服务器时间有延时,取决于到消息到 调用这个接口的时间差
        /// </summary>
        public void ReconnectFuc()
        {
            if (cacheData.reconnectData == null)
            {
                return;
            }
            reconnected = true;
            //如果还在loading 阶段，走正常的Loading 进度
            //已经不是loading状态了
            if (cacheData.ServerDataState != AutoChessStateType.AUTO_CHESS_STATE_LOADING)
            {
                EnterAutoChessField(true);
            }
            else
            {
                EnterAutoChessField();
            }

            ServerTimerTool.Reset();
            ServerTimerTool.CorrectTime(cacheData.reconnectData.info.time);
            cacheData.reconnectData = null;
        } 
        //主动重连的消息
        private void OnSCAutoChessPlayerEnter(object msg)
        {
            ReconnectFuc();
            DebugLog("自走棋 【重新进入游戏】");
        }

        //锁定商店
        private void OnSCAutoChessLockShop(object msg)
        {
            var data = msg as SCAutoChessLockShop;
            EventManager.TriggerEvent(CommonEvent.On_Shop_Lock_State_Change);
        }
          
        /// <summary>
        /// 通用刷新格子响应
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessRefreshChesses(object msg)
        {
            var data = msg as SCAutoChessRefreshChesses;
            var player = cacheData.GetPlayerData(data.guid);
            if (player.IsDeath)
                return;
            //1、移动删除 
            foreach (var item in data.posChangeInfos)
            {
                player.UpdateGridPos(item, data.opType);//里面构建逻辑
            }
            //2、添加数据
            foreach (var item in data.chessInfos)
            {
                player.OnOpreateAddHeroData(item, data.opType);//里面构建逻辑
            }

            DebugLog("自走棋 【通用刷新格子响应...】= "+ data.opType.ToString());
        }

        /// <summary>
        /// 加载的玩家进度
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessLoadingProgress(object msg)
        {
            var data = msg as SCAutoChessLoadingProgress;
            AutoChessLoadingProgress cur;
            for (int i = 0; i < data.loadingProgresses.Count; i++)
            {
                cur = data.loadingProgresses[i];
                var player = cacheData.GetPlayerData(cur.playerId);
                player.LoadingProgress = cur;
            }
            DebugLog("自走棋 【刷新玩家进度...】");
        }

        /// <summary>
        /// 当前战场状态数据
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessStateChange(object msg)
        {
            var data = msg as SCAutoChessStateChange;
            cacheData.UpdateServerState(data.stateInfo);
            DebugLog("自走棋 【服务器变更战场状态...】"+" ---  "+data.stateInfo.stateType.ToString());
        }
        /// <summary>
        /// 移动棋子
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessMoveChess(object msg)
        {
            AutoChessFieldViewCtr.Ins.InputCtr.ResetPreviewControlData();
            DebugLog("自走棋 【移动棋子...】");
        }
      
        /// <summary>
        /// 购买棋子响应
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessBugChess(object msg)
        {
            AutoChessFieldViewCtr.Ins.InputCtr.ResetPreviewControlData();
            DebugLog("自走棋 【购买棋子响应...】");
        }

        /// <summary>
        /// 匹配一个玩家战斗
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessMatchRes(object msg)
        {
            var data = msg as SCAutoChessMatchRes;
            var playerId = data.left.pid; //这个数据对应的玩家数据
            var playerData = cacheData.GetPlayerData(playerId);
            if (playerData != null)
            {
                playerData.oneMatchRes = data;

            }

            DebugLog("自走棋 【匹配到一个玩家 构建命令...】");
        }

        /// <summary>
        /// 返回战斗结果
        /// </summary>
        private void OnSCAutoChessFightRes(object msg)
        {
            var data = msg as SCAutoChessFightRes;
            var playerId = data.left.pid;
            var playerData = cacheData.GetPlayerData(playerId);
            if (playerData != null)
            {
                playerData.oneFightResult = data;
            }
            //只有在战场才能进入战斗
            if (currentState.GetStateType() == AutoChessModeState.GameFieldtate && playerId == cacheData.CurPlayerData.GUID)
            {
                AutoChessManager.Ins.CurrentAutoChessField.fightCtr.OnCreateAllFightEntity();
                SwitchState(AutoChessModeState.ShowFightState);
                return;
            }
        }

        /// <summary>
        /// 结算一个玩家
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessSettlement(object msg)
        {
            var data = msg as SCAutoChessSettlement;
            DebugLog("自走棋 【收到一个玩家结算信息 ...】");
        }

        /// <summary>
        /// 请求
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessPlayerQuit(object msg)
        {
           AutoChessManager.Ins.ExistGameFieldToScene();
        }

        /// <summary>
        /// 升级船响应
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessUpgradeShip(object msg)
        {
        }
        /// <summary>
        /// 刷新船只属性响应
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessRefreshShip(object msg)
        {
            var data = msg as SCAutoChessRefreshShip;
            var player = cacheData.GetPlayerData(data.guid);
            player.UpdateShipInfo(data.shipInfo);
            EventManager.TriggerEvent(CommonEvent.On_Shop_Lock_State_Change);
            DebugLog("自走棋 【刷新船只属性...】");
        }
        /// <summary>
        /// 出售响应
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessSellChess(object msg)
        {
        }
        /// <summary>
        /// 升星响应
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessGrowthChessStar(object msg)
        {
        }
        /// <summary>
        /// 刷新购买棋子响应
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessRefreshBuyChesses(object msg)
        {
        }
        /// <summary>
        /// 刷新主页面信息
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessInfo(object msg)
        {
            var data = msg as SCAutoChessInfo;
            AutoChessManager.ins.cacheData.UpdateMatchInfo(data);
            // 页面没有打开 战斗状态 直接进战斗
            if (!cacheData.MatchPageIsOpening)
            {
                if (data.state == AutoChessMatchState.FIGHT)
                {
                    SendCSAutoChessPlayerEnter();
                }
                else
                {
                    GameMain.Instance.StartCoroutine(PageOpen());
                }
            }
        }

        IEnumerator PageOpen()
        {
            LoadingPanel.Instance.ShowSweepMask();
            yield return new WaitForSeconds(0.4f);
            Yunchang.PageManager.Instance.OpenPage("AutoChessModePage");
        }

        /// <summary>
        /// 开始匹配
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessMatch(object msg)
        {
            var data = msg as SCAutoChessMatch;
            AutoChessManager.ins.cacheData.OnMatchStartInfoUpdate(data);
        }

        /// <summary>
        /// 匹配成功
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCAutoChessMatchSucess(object msg)
        {
            var data = msg as SCAutoChessMatchSucess;
            AutoChessManager.ins.cacheData.OnMatchSuccessInfoUpdate(data);
        }

        /// <summary>
        /// 取消匹配
        /// </summary>
        /// <param name="msg"></param>
        private void OnSCCancelAutoChessMatch(object msg)
        {
            var data = msg as SCCancelAutoChessMatch;
            AutoChessManager.ins.cacheData.OnMatchCancelInfoUpdate(data);
        }
        #endregion

        #region SendMsg
        /// <summary>
        /// 匹配数据刷新请求
        /// </summary>
        public void SendCSAutoChessInfo()
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessInfo, new CSAutoChessInfo(), OpDefine.SCAutoChessInfo);
        }

        /// <summary>
        /// 请求开始匹配
        /// </summary>
        public void SendCSAutoChessMatch()
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessMatch, new CSAutoChessMatch(), OpDefine.SCAutoChessMatch);
        }

        /// <summary>
        /// 请求取消匹配
        /// </summary>
        public void SendCSCancelAutoChessMatch()
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSCancelAutoChessMatch, new CSCancelAutoChessMatch(), OpDefine.SCCancelAutoChessMatch);
        }

        /// <summary>
        /// 加载进度
        /// </summary>
        /// <param name="progress"></param>
        /// <param name="isOver"></param>
        public void SendCSAutoChessLoadingProgress(double progress,bool isOver )
        {
            var msg = new CSAutoChessLoadingProgress();
            msg.loadingProgress = new AutoChessLoadingProgress();
            msg.loadingProgress.playerId = StaticData.playerData.playerId;
            msg.loadingProgress.progress = progress;
            msg.loadingProgress.isOver = isOver;
            NetworkDriver.Instance.SendSocket(OpDefine.CSAutoChessLoadingProgress, msg);
        }

        /// <summary>
        /// 棋子移动
        /// </summary>
        /// <param name="srcPos"></param>
        /// <param name="tarPos"></param>
  		public void SendCSAutoChessMoveChess(int srcPos, int tarPos)
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessMoveChess, new CSAutoChessMoveChess() { srcPos = srcPos, tarPos = tarPos },OpDefine.SCAutoChessMoveChess);
        }

        /// <summary>
        /// 船升级
        /// </summary>
        public void SendUpgradeShipBlock()
        {
            if (cacheData.CurPlayerData.IsSeeSelf)
            {
                var maxLevel = Table.Blo.AutoChessBlo.GetMaxChessLevel();
                if (cacheData.CurPlayerData.ShipLevel < maxLevel)
                {
                    NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessUpgradeShip, new CSAutoChessUpgradeShip(), OpDefine.SCAutoChessUpgradeShip);
                }
                else
                {
                    GlobalLazyMessageManager.Instance.CreateGlobalPopTip("alreadyMaxLevel");
                }
            }
        }

        /// <summary>
        /// 升星
        /// </summary>
        /// <param name="serverPos"></param>
        public void SendUpgradeStar(int serverPos)
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessGrowthChessStar, new CSAutoChessGrowthChessStar() { pos = serverPos},OpDefine.SCAutoChessGrowthChessStar);
        }

        /// <summary>
        /// 出售棋子
        /// </summary>
        /// <param name="serverPos"></param>
        public void SendSellChess(int serverPos)
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessSellChess, new CSAutoChessSellChess() { pos = serverPos },OpDefine.SCAutoChessSellChess);
        }

        /// <summary>
        /// 刷新棋子
        /// </summary>
        public void SendRefreshChess()
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessRefreshBuyChesses, new CSAutoChessRefreshBuyChesses() , OpDefine.SCAutoChessRefreshBuyChesses);
        }

        /// <summary>
        /// 购买棋子
        /// </summary>
        public void SendBuyChess(int serverPos, int tarPos = 0)
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessBugChess, new CSAutoChessBugChess() { pos = serverPos, tarPos = tarPos }, OpDefine.SCAutoChessBugChess);
        }
        //请求退出
        public void SendCSAutoChessPlayerQuit()
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessPlayerQuit, new CSAutoChessPlayerQuit() , OpDefine.SCAutoChessPlayerQuit);
        }
        //锁定商店
        public void SendCSLockShop()
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessLockShop, new CSAutoChessLockShop(), OpDefine.SCAutoChessLockShop);
        }

        // 请求返回游戏
        public void SendCSAutoChessPlayerEnter()
        {
            NetworkDriver.Instance.SendSocket(OpDefine.CSAutoChessPlayerEnter, new CSAutoChessPlayerEnter());
        }
        /// <summary>
        /// 战斗完成
        /// </summary>
        public void SendCSAutoChessFightFinish()
        {
            NetworkDriver.Instance.SendSocket(OpDefine.CSAutoChessFightFinish, new CSAutoChessFightFinish());
        }
        /// <summary>
        /// 请求战斗回放
        /// </summary>
        public void SendCSAutoChessGetFightRecords()
        {
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessGetFightRecords, new CSAutoChessGetFightRecords(), OpDefine.SCAutoChessGetFightRecords);
        }
        /// <summary>
        /// 查看战斗回放
        /// </summary>
        public void SendCSAutoChessGetFightReplay(long fightId)
        {
            CSAutoChessGetFightReplay repley = new ProtoBuf.Message.CSAutoChessGetFightReplay();
            repley.fightId = fightId;
            NetworkDriver.Instance.SendSocketBlock(OpDefine.CSAutoChessGetFightReplay, repley, OpDefine.SCAutoChessGetFightReplay);
        }

        #endregion
    }
}
